﻿<#--
生成实体的模板
-->
<#include "../base.ftl">
	
<@pp.dropOutputFile />
<#list project.entities as entity>
	<#if entity.package??>	
		<@pp.changeOutputFile name="/src/java/" + pathUrl(entity.package!) + "/" + entity.className + ".java" />
package ${entity.package};			
	</#if>

import java.io.Serializable;
import java.util.Date;	
<#if entity.onetomanys?? || entity.manytomanys??>
import java.util.HashSet;
import java.util.Set;
</#if>
import javax.persistence.*;
<#setting datetime_format="yyyy-MM-dd HH:mm:ss">
/**
 * ${entity.className} generated by springside codegen
 *
 * @author ${project.author}
 * ${pp.now}
 */
<@Entity entity />
<#if entity.table??>
<@Table entity.table! />
</#if>
<#if entity.inheritance??>
<@Inheritance entity.inheritance! />
</#if>
<#if entity.primaryKeyJoinColumns??>
<@PrimaryKeyJoinColumns entity.primaryKeyJoinColumns! />
</#if>
<#if entity.attributeOverrides??>
<@AttributeOverrides entity.attributeOverrides! />
</#if>
<#if entity.secondaryTables??>
<@SecondaryTables entity.secondaryTables! />
</#if>
<#if entity.idClass??>
<@IdClass entity.idClass! />
</#if>
<#if entity.tableGenerator??>
<@TableGenerator entity.tableGenerator! />
</#if>
<#if entity.sequenceGenerator??>
<@SequenceGenerator entity.sequenceGenerator! />
</#if>
<#if entity.hibernateGenerator??>
<@HibernateGenerator entity.hibernateGenerator! />
</#if>
<@Class entity/> 
{
	<@Ids entity! />	

<#if entity.embeddedId??>
	<@EmbeddedId entity.embeddedId! />
</#if>
<#if entity.fields??>
	<@Fields entity.fields! />	
</#if>
<#if entity.embeddedFields??>
	<@EmbeddedFields entity.embeddedFields! />	
</#if>
<#if entity.collectionFields??>
	<@CollectionFields entity.collectionFields! />	
</#if>
<#if entity.onetoones??>
	<@OneToOnes entity.onetoones! />	
</#if>
<#if entity.onetomanys??>
	<@OneToManys entity.onetomanys! />	
</#if>
<#if entity.manytomanys??>
	<@ManyToManys entity.manytomanys! />	
</#if>

	<@getIds entity! />	

<#if entity.embeddedId??>
	<@getEmbeddedId entity.embeddedId! />
</#if>
<#if entity.fields??>
	<@getFields entity.fields! />	
</#if>
<#if entity.embeddedFields??>
	<@getEmbeddedFields entity.embeddedFields! />	
</#if>
<#if entity.collectionFields??>
	<@getCollectionFields entity.collectionFields! />	
</#if>
<#if entity.onetoones??>
	<@getOneToOnes entity.onetoones! />	
</#if>
<#if entity.onetomanys??>
	<@getOneToManys entity.onetomanys! />	
</#if>
<#if entity.manytomanys??>
	<@getManyToManys entity.manytomanys! />	
</#if>
	<@setIds entity! />	

<#if entity.embeddedId??>
	<@setEmbeddedId entity.embeddedId! />
</#if>
<#if entity.fields??>
	<@setFields entity.fields! />	
</#if>
<#if entity.embeddedFields??>
	<@setEmbeddedFields entity.embeddedFields! />	
</#if>
<#if entity.collectionFields??>
	<@setCollectionFields entity.collectionFields! />	
</#if>
<#if entity.onetoones??>
	<@setOneToOnes entity.onetoones! />	
</#if>
<#if entity.onetomanys??>
	<@setOneToManys entity.onetomanys! />	
</#if>
<#if entity.manytomanys??>
	<@setManyToManys entity.manytomanys! />	
</#if>
}
</#list>	